#define _CRT_SECURE_NO_WARNINGS 1
#include"ObjectPool.h"
#include"ThreadCache.h"
#include"ConcurrentAlloc.h"

void alloc1() {
	for (size_t i = 0; i < 10; ++i)
	{
		void* ptr = ConcurrentAlloc(6);
	}
}
void alloc2() {
	for (size_t i = 0; i < 10; ++i)
	{
		void* ptr = ConcurrentAlloc(10);
	}
}
void TestTSL() {
	std::thread t1(alloc1);
	t1.join();

	std::thread t2(alloc2);
	t2.join();
}

void TestConcurrentAlloc()
{
	void* ptr1 = ConcurrentAlloc(1);
	void* ptr2 = ConcurrentAlloc(5);
	void* ptr3 = ConcurrentAlloc(8);
	
	ConcurrentFree(ptr1);
	ConcurrentFree(ptr2);
	ConcurrentFree(ptr3);
	

}

void TestConcurrentAlloc2()
{
	for (size_t i = 0; i < 1024; i++)
	{
		void* p = ConcurrentAlloc(7);
		cout << p << endl;
	}
	void* p=ConcurrentAlloc(8);
}
//int main() {
//
//	TestConcurrentAlloc();
//	return 0;
//	
//}
